﻿using Kingdee.BOS.App.Data;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.DynamicForm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.Bill.PlugIn.Args;
using Kingdee.BOS.Core.Metadata.FormElement;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.JSON;
using Kingdee.BOS.App.Data;
using System.Data;
using Kingdee.BOS.Core.Bill;
using Kingdee.BOS.Core.Metadata;
namespace LiMinCRMPlugin
{
    /// <summary>
    /// 当日可发量表单插件      
    /// mey
    /// 2024年6月19日
    /// </summary>
    [System.ComponentModel.Description("当日可发量表单插件")]
    [HotUpdate]
    public class AvailableQuantityForm : AbstractBillPlugIn
    {
        public override void ButtonClick(ButtonClickEventArgs e)
        {
            base.ButtonClick(e);
        }

        public override void EntityRowDoubleClick(EntityRowClickEventArgs e)
        {
            base.EntityRowDoubleClick(e);
            string InFid = "";
            string OutFid = "";

            if (e.ColKey == "F_QLTK_PRERECORDED")
            {
                InFid = this.View.Model.GetValue("F_QLTK_InFID", e.Row).ToString().Trim();
                if (InFid != "0")
                {
                    //以单据视图打开
                    BillShowParameter para = new BillShowParameter();
                    //para.OpenStyle.ShowType = ShowType.Modal;
                    //采购订单唯一标识
                    para.FormId = "QLTK_PreRecorded";
                    //样式 view 查看
                    para.Status = OperationStatus.VIEW;
                    //要打开单据的FID
                    para.PKey = InFid;
                    //para.ParentPageId = this.View.ParentFormView.PageId;
                    this.View.ShowForm(para);
                }
            }
            else if (e.ColKey == "F_QLTK_OUTBOUNDQUANTITY")
            {
                OutFid = this.View.Model.GetValue("F_QLTK_OutFID", e.Row).ToString().Trim();
                if (OutFid != "0")
                {
                    //以单据视图打开
                    BillShowParameter para = new BillShowParameter();
                    //para.OpenStyle.ShowType = ShowType.Modal;
                    //采购订单唯一标识
                    para.FormId = "QLTK_OutboundQuantity";
                    //样式 view 查看
                    para.Status = OperationStatus.VIEW;
                    //要打开单据的FID
                    para.PKey = OutFid;
                    //para.ParentPageId = this.View.ParentFormView.PageId;
                    this.View.ShowForm(para);
                }
            }





        }

    }
}
